<?php echo $header; ?>


<script type="text/javascript" src="http://vkontakte.ru/js/api/share.js?9"></script>

            
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
<div id="notification"></div>
<?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <h1><?php echo $heading_title; ?></h1>
  <div class="h1-bb"></div>
  

<p><?php echo $text_description; 
if($coupon) {
	echo $text_coupon;
}
?></p>

            
  

    <table>
        <tr>
            <td>
                <?php echo $text_code; ?><br />
                <textarea cols="40" rows="5"><?php echo $code; ?></textarea>
            </td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <?php echo $text_home_url; ?><br />
                <textarea cols="40" rows="5"><?php echo $home; ?></textarea>
            </td>
        </tr>
        <tr>
            <td></td> <td></td>
            <td>
      <!-- AddThis Button BEGIN -->
          <div class="addthis_default_style">
              <a class="addthis_button_compact" addthis:url='<?php echo $home; ?>' addthis:title='<?php echo $name; ?>' addthis:image='<?php echo $logo; ?>' ><?php echo $button_vk; ?></a><a></a>
          </div>
          <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script> 
      <!-- AddThis Button END --> 
            </td>
        </tr>
    </table>

            


  <p><?php echo $text_generator; ?><br />
    <input type="text" name="product" value="" />
  </p>
  <p>

    <table>
        <tr>
            <td>
                <?php echo $text_link; ?><br />
                <textarea name="link" cols="40" rows="5"></textarea>
            </td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <?php echo $text_register_url; ?><br />
                <textarea cols="40" rows="5"><?php echo $register; ?></textarea>
            </td>
        </tr>
        <tr>
            <td></td> <td></td>
            <td>
      <!-- AddThis Button BEGIN -->
          <div class="addthis_default_style">
              <a class="addthis_button_compact" addthis:url='<?php echo $register; ?>' addthis:title='<?php echo $name; ?>' addthis:image='<?php echo $logo; ?>' ><?php echo $button_vk; ?></a><a></a>
          </div>
          <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script> 
      <!-- AddThis Button END --> 
            </td>
        </tr>
    </table>

            




    <div class="tracking-product">
        <?php foreach ($category as $cat) { ?> 
        <?php foreach ($cat as $categor) { ?> 
        <p>
            <a onclick="referal('<?php echo $categor['href']; ?>');" ><div id ="trackingcategory" class="name" ><?php echo $categor['name']; ?>
                    <div style="margin: auto; width: 110px;">
	  <!-- AddThis Button BEGIN -->
          <div class="addthis_default_style">
              <a class="addthis_button_compact" addthis:url='<?php echo $categor["href"]; ?>' addthis:title='<?php echo $categor["name"]; ?>' addthis:image='<?php echo $categor["thumb"]; ?>' ><?php echo $button_vk; ?></a><a></a>
          </div>
          <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script> 
      <!-- AddThis Button END --> 
                    </div>
                </div></a>
        </p>
        <?php $products =  $categor['products'];?>
        <?php foreach ($products as $product) { ?>
        <div>
            <?php if ($product['thumb']) { ?>
            <div class="image"><a onclick="referal('<?php echo $product['href']; ?>');"><img src="<?php echo $product['thumb']; ?>" class="loadimg" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>"/></a></div>
            <?php } ?>
            <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
            <div class="description"><?php echo $product['description']; ?></div>
            <div class="vkcom">
	  <!-- AddThis Button BEGIN -->
          <div class="addthis_default_style">
              <a class="addthis_button_compact" addthis:url='<?php echo $product["href"]; ?>' addthis:title='<?php echo $product["name"]; ?>' addthis:image='<?php echo $product["thumb"]; ?>' ><?php echo $button_vk; ?></a><a></a>
          </div>
          <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script> 
      <!-- AddThis Button END --> 
            </div>
        </div>
        <?php } ?> 
        <?php } ?>
        <?php } ?>
    </div>

            
  <div class="buttons">
    <div class="right"><a href="<?php echo $continue; ?>" class="button"><?php echo $button_continue; ?></a></div>
  </div>
  <?php echo $content_bottom; ?></div>

			
<script type="text/javascript"><!--
function referal(url) {
    $('textarea[name=\'link\']').val(url);
}
//--></script>
			
            
<script type="text/javascript"><!--
$('input[name=\'product\']').autocomplete({
	delay: 0,
	source: function(request, response) {
		$.ajax({
			url: 'index.php?route=affiliate/tracking/autocomplete&filter_name=' +  encodeURIComponent(request.term),
			dataType: 'json',
			success: function(json) {		
				response($.map(json, function(item) {
					return {
						label: item.name,
						value: item.link
					}
				}));
			}
		});
	},
	select: function(event, ui) {
		$('input[name=\'product\']').attr('value', ui.item.label);
		$('textarea[name=\'link\']').attr('value', ui.item.value);
						
		return false;
	},
	focus: function(event, ui) {
      return false;
   }
});
//--></script> 
<?php echo $footer; ?>
